/*
*/

#include "prog.h"

#include "beam.h"
#include "display.h"
#include "event.h"
#include "form.h"
#include "timer.h"

u32 Prog(u32 stt){
    u32	evn,t_m;
    KEY	key;
    
    if(!Decode(&signal,&key))
	return STT_LEARNING;
    FlashAll();
    t_m=Timer();
    while(stt==STT_SIGNAL){
	evn=WaitEvent();
	switch(evn&EVN_MASK){
	case EVN_KEYPRESS:
	    keywave[GetKey(evn)]=key;
	    stt=STT_LEARNING;
//	    IndicatorOn();
	    break;
	}
	if(TimeOut(t_m,TIM_OUT)){
	    stt=STT_NIL;
	    IndicatorOff();
	}
    }
    return stt;
}
